<template>
  <div style="background:#f1f1f1">
    <p @click="$router.back(-1)" class="back_p"><span><i class="el-icon-arrow-left"></i>返回</span><span>{{orgname}}</span></p>
    <div class="select_top">
      <span class="w_tip">
        <p>填报频率要求：每{{dateValue}}</p>
        <p>填报期限 {{dateValue2}}</p>
      </span>
      <el-date-picker
        style="width:15%;margin-right:1%"
        v-model="year"
        type="year"
        placeholder="选择年"
      >
      </el-date-picker>
      <el-button @click="getassess2List">筛选</el-button>
    </div>
    <el-table
      :data="assess2List"
      style="width: 92%;font-size:13px;margin: 20px auto"
    >
      <el-table-column
        type="index"
        width="50"
        label="序号"
      >
      </el-table-column>
      <el-table-column
        prop="hash.orgname"
        label="考核对象"
      >
      </el-table-column>
      <el-table-column
        prop="hash.manager"
        label="联系人"
      >
      </el-table-column>
      <el-table-column
        prop="hash.status"
        label="状态"
      >
      </el-table-column>
      <el-table-column
        label="操作"
        width="120"
      >
        <template slot-scope="scope">
          <el-button
            @click="goAssess3(scope.row)"
            type="primary"
            size="small"
          >
            查看
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  data() {
    return {
      ts: this.newStore(),
      assess2List: [],
      orgname: this.$route.query.name,
      dateValue: '',
      dateValue2: '',
      year: '',
    };
  },
  created() {
    this.getdateValue();
    this.getassess2List();
  },
  methods: {
    goAssess3(item) {
      this.$router.push({
        path: 'grade3',
        query: {
          aorgid: this.$route.query.aorgid, propertyid: this.$route.query.propertyid, year: item.hash.time, name: this.$route.query.name, orgname: item.hash.orgname, borgid: item.hash.borgid,
        },
      });
    },
    getdateValue() {
      const req = {
        handle: '04A3682CDCA57EBA0DA6C15FB2ECC84BE133DA25EC7F9F14B5D3ABB56224205E',
        id: this.$route.query.propertyid,
      };
      this.spost(this.ts, '/mainservlet', req).then((ts) => {
        this.dateValue = ts.d.data.operation1[0].hash.type;
        ts.d.data.operation2.forEach((element) => {
          this.dateValue2 += `,${element.hash.day}`;
        });
      });
    },
    getassess2List() {
      this.year = this.$route.query.year;
      const req = {
        handle: '04A3682CDCA57EBA0DA6C15FB2ECC84BDA12E083D738952BC15B67093C8E6FE5',
        type: '2',
        aorgid: this.$route.query.aorgid,
        borgid: '',
        propertyid: this.$route.query.propertyid,
        year: this.year,
        date: '',
        status: '',
        norm_ntype: '2',
      };
      this.spost(this.ts, '/mainservlet', req).then((ts) => {
        this.assess2List = ts.d.data.operation1;
      });
    },
  },
};
</script>

<style lang="stylus" scoped>
.w_tip
  width 200px
  line-height 27px
  float left
.el-input--suffix .el-input__inner
  font-size 13px
.el-button
  font-size 13px
.back_p
  text-align center
  height 55px
  line-height 55px
  cursor pointer
  padding 0 30px
  background #fff
  box-shadow 0px 1px 5px #ccc
  span
    &:first-child
      float left
    &:last-child
      font-size 18px
      color #26a2ff
      padding-right 60px
.el-select
  width 14%
  margin-right 1%
.select_top
  width 92%
  margin 20px auto
.el-col
  padding: 20px 10px;
</style>
